/**
 */
package fUML.Semantics.CommonBehaviors.Communications.impl;

import fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution;
import fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue;

import fUML.Semantics.CommonBehaviors.Communications.ClassifierBehaviorExecution;
import fUML.Semantics.CommonBehaviors.Communications.CommunicationsPackage;
import fUML.Semantics.CommonBehaviors.Communications.ObjectActivation;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EcoreUtil;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Classifier Behavior Execution</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fUML.Semantics.CommonBehaviors.Communications.impl.ClassifierBehaviorExecutionImpl#getExecution <em>Execution</em>}</li>
 *   <li>{@link fUML.Semantics.CommonBehaviors.Communications.impl.ClassifierBehaviorExecutionImpl#getClassifier <em>Classifier</em>}</li>
 *   <li>{@link fUML.Semantics.CommonBehaviors.Communications.impl.ClassifierBehaviorExecutionImpl#getObjectActivation <em>Object Activation</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ClassifierBehaviorExecutionImpl extends EObjectImpl implements ClassifierBehaviorExecution {
	/**
	 * The cached value of the '{@link #getExecution() <em>Execution</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExecution()
	 * @generated
	 * @ordered
	 */
	protected Execution execution;

	/**
	 * The cached value of the '{@link #getClassifier() <em>Classifier</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClassifier()
	 * @generated
	 * @ordered
	 */
	protected fUML.Syntax.Classes.Kernel.Class classifier;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ClassifierBehaviorExecutionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CommunicationsPackage.Literals.CLASSIFIER_BEHAVIOR_EXECUTION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Execution getExecution() {
		if (execution != null && execution.eIsProxy()) {
			InternalEObject oldExecution = (InternalEObject)execution;
			execution = (Execution)eResolveProxy(oldExecution);
			if (execution != oldExecution) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__EXECUTION, oldExecution, execution));
			}
		}
		return execution;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Execution basicGetExecution() {
		return execution;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setExecution(Execution newExecution) {
		Execution oldExecution = execution;
		execution = newExecution;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__EXECUTION, oldExecution, execution));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public fUML.Syntax.Classes.Kernel.Class getClassifier() {
		if (classifier != null && classifier.eIsProxy()) {
			InternalEObject oldClassifier = (InternalEObject)classifier;
			classifier = (fUML.Syntax.Classes.Kernel.Class)eResolveProxy(oldClassifier);
			if (classifier != oldClassifier) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__CLASSIFIER, oldClassifier, classifier));
			}
		}
		return classifier;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public fUML.Syntax.Classes.Kernel.Class basicGetClassifier() {
		return classifier;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setClassifier(fUML.Syntax.Classes.Kernel.Class newClassifier) {
		fUML.Syntax.Classes.Kernel.Class oldClassifier = classifier;
		classifier = newClassifier;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__CLASSIFIER, oldClassifier, classifier));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ObjectActivation getObjectActivation() {
		if (eContainerFeatureID() != CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION) return null;
		return (ObjectActivation)eContainer();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetObjectActivation(ObjectActivation newObjectActivation, NotificationChain msgs) {
		msgs = eBasicSetContainer((InternalEObject)newObjectActivation, CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION, msgs);
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setObjectActivation(ObjectActivation newObjectActivation) {
		if (newObjectActivation != eInternalContainer() || (eContainerFeatureID() != CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION && newObjectActivation != null)) {
			if (EcoreUtil.isAncestor(this, newObjectActivation))
				throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
			NotificationChain msgs = null;
			if (eInternalContainer() != null)
				msgs = eBasicRemoveFromContainer(msgs);
			if (newObjectActivation != null)
				msgs = ((InternalEObject)newObjectActivation).eInverseAdd(this, CommunicationsPackage.OBJECT_ACTIVATION__CLASSIFIER_BEHAVIOR_EXECUTIONS, ObjectActivation.class, msgs);
			msgs = basicSetObjectActivation(newObjectActivation, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION, newObjectActivation, newObjectActivation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void execute(fUML.Syntax.Classes.Kernel.Class classifier, EList<ParameterValue> inputs) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void terminate() {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void _startObjectBehavior() {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION:
				if (eInternalContainer() != null)
					msgs = eBasicRemoveFromContainer(msgs);
				return basicSetObjectActivation((ObjectActivation)otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION:
				return basicSetObjectActivation(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
		switch (eContainerFeatureID()) {
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION:
				return eInternalContainer().eInverseRemove(this, CommunicationsPackage.OBJECT_ACTIVATION__CLASSIFIER_BEHAVIOR_EXECUTIONS, ObjectActivation.class, msgs);
		}
		return super.eBasicRemoveFromContainerFeature(msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__EXECUTION:
				if (resolve) return getExecution();
				return basicGetExecution();
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__CLASSIFIER:
				if (resolve) return getClassifier();
				return basicGetClassifier();
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION:
				return getObjectActivation();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__EXECUTION:
				setExecution((Execution)newValue);
				return;
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__CLASSIFIER:
				setClassifier((fUML.Syntax.Classes.Kernel.Class)newValue);
				return;
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION:
				setObjectActivation((ObjectActivation)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__EXECUTION:
				setExecution((Execution)null);
				return;
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__CLASSIFIER:
				setClassifier((fUML.Syntax.Classes.Kernel.Class)null);
				return;
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION:
				setObjectActivation((ObjectActivation)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__EXECUTION:
				return execution != null;
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__CLASSIFIER:
				return classifier != null;
			case CommunicationsPackage.CLASSIFIER_BEHAVIOR_EXECUTION__OBJECT_ACTIVATION:
				return getObjectActivation() != null;
		}
		return super.eIsSet(featureID);
	}

} //ClassifierBehaviorExecutionImpl
